<template>
  <!-- 头部部分 -->
  <!-- 底部部分 -->
  <footer class="footer">
    <span class="todo-count"
      ><strong>{{ sum }}</strong
      >剩余</span
    >
    <ul class="filters">
      <li>
        <a
          :class="{ selected: type === 'all' }"
          href="#/"
          @click="tabqiehuan('all')"
          >全部</a
        >
      </li>
      <li>
        <a
          href="#/active"
          :class="{ selected: type === 'active' }"
          @click="tabqiehuan('active')"
          >进行中</a
        >
      </li>
      <li>
        <a
          href="#/completed"
          @click="tabqiehuan('completed')"
          :class="{ selected: type === 'completed' }"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" v-show="clearBtn" @click="delAll">
      清除已完成
    </button>
  </footer>
</template>

<script>
export default {
  name: 'TdFooter',
  components: {},
  props: {
    sum: {
      type: Number,
      required: true,
    },
    clearBtn: {
      type: Boolean,
      required: true,
    },
    type: {
      type: String,
      required: true,
    },
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    delAll() {
      this.$emit('delAll')
    },
    // 添加类名，点击事件传给父元素
    tabqiehuan(value) {
      this.$emit('tabqiehuan', value)
    },
  },
}
</script>

<style scoped></style>
